package online.afeibaili.storebackendframework.model.json


/**
 * 优惠券映射类
 *
 *@author AfeiBaili
 *@version 2025/10/25 21:28
 */

class CouponJsonMapper() {

    var couponId: Long = 0
    var getTime: Long = 0
    var count: Int = 0

    constructor(couponId: Long, getTime: Long, count: Int) : this() {
        this.couponId = couponId
        this.getTime = getTime
        this.count = count
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is CouponJsonMapper) return false

        if (couponId != other.couponId) return false
        if (getTime != other.getTime) return false
        if (count != other.count) return false

        return true
    }

    override fun hashCode(): Int {
        var result = couponId.hashCode()
        result = 31 * result + getTime.hashCode()
        result = 31 * result + count
        return result
    }

    override fun toString(): String {
        return "CouponJsonMapper(couponId=$couponId, getTime=$getTime, count=$count)"
    }

    operator fun plus(couponJsonMapper: CouponJsonMapper) =
        CouponJsonMapper(this.couponId, this.getTime + couponJsonMapper.getTime, this.count + couponJsonMapper.count)

    companion object : JsonMapperAbstract<CouponJsonMapper>(CouponJsonMapper::class.java)
}